<extend name="./main" />

<block name="main">
<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr align='left' bgcolor="#ccc">
					<th>ID</th>
					<th>用户名</th>
					<th>昵称</th>
				
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<?php foreach($list as $vo):?>
				<tr>
					<td>{$vo['id']}</td>
					<td>{$vo['username']}</td>
					<td>{$vo['nickname']}</td>
			
		
					<td>

	<button class='btn btn-primary' anid="<?=$vo['id']?>" onclick="jz(this)">禁止访问</button>
         
	<button class='btn btn-primary' anid="<?=$vo['id']?>"  onclick="qx(this)">允许</button>
					</td>
				</tr>
				<?php endforeach;?>
			</volist>
			</tbody>
			
			
		</table>
		<script >
       

         function jz(obj){
         	var anid=$(obj).attr('anid');
           // alert(anid);
         	var login1=1;
         	$.ajax({
         		type:'POST',
         		url:"{:U('User/jz')}",
         		data:{login:login1,id:anid},
         		
         		success:function(data){
         		  if(data.status == 0){
                    alert("禁止访问");  
                }else if(data['status'] == 1)
                {
                   alert("设置失败");
                }
                	
         		}
         	});
         }


     function qx(obj){
     	var anid=$(obj).attr('anid');
           // alert(anid);
         	var login1=0;
         	$.ajax({
         		type:'POST',
         		url:"{:U('User/qx')}",
         		data:{login:login1,id:anid},
         		
         		success:function(data){
         		  if(data.status == 0){
                    alert("可以访问");  
                }else if(data['status'] == 1)
                {
                   alert("设置失败");
                }
                	
         		}
         	});
     }





		</script>

</block>

